{include file="header.html"}
<div id="rightTop">
    <p>本期热卖</p>
    <ul class="subnav">
        <li><span>{$lang.manage}</span></li>
        <li><a class="btn1" href="index.php?app=hotgoods&amp;act=add">{$lang.add}</a></li>
        <li><a href="javascript:void(0)" class="feature_btn btn1" cate_id="-1" store_text="{$recommend_store.-1.store_text}">推荐商品</a></li>
    </ul>
</div>
<div class="mrightTop">
    <div class="fontl">
    </div>
    <div class="fontr">
        {include file=page.top.html}
    </div>
</div>
<div class="tdare">
    <table width="100%" cellspacing="0" class="dataTable">
        <!--{if $hotgoods}-->
        <tr class="tatr1">
            <td width="20" class="firstCell"><input type="checkbox" class="checkall" /></td>
            <td>标题</td>
            <td>链接</td>
            <td class="table-center">
                <span ectype="order_by" fieldname="is_recommend">推荐</span>
            </td>
            <td class="table-center">
                <span ectype="order_by" fieldname="is_hot">标红</span>
            </td>
            <td class="table-center">{$lang.sort_order}</td>
            <td class="handler">{$lang.handler}</td>
        </tr>
        <!--{/if}-->
        <!--{foreach from=$hotgoods item=item}-->
        <tr class="tatr2">
            <td class="firstCell"><input type="checkbox" class="checkitem" value="{$item.id}" /></td>
            <td><span ectype="inline_edit" fieldname="title" fieldid="{$item.id}" required="1" class="node_name editable">{$item.title|escape}</span></td>
            <td>{$item.link|escape}</td>
            <td class="table-center">
                <!--{if $item.is_recommend}-->
                <img src="templates/style/images/positive_enabled.gif" ectype="inline_edit" fieldname="is_recommend" fieldid="{$item.id}" fieldvalue="1" title="{$lang.editable}"/>
                <!--{else}-->
                <img src="templates/style/images/positive_disabled.gif" ectype="inline_edit" fieldname="is_recommend" fieldid="{$item.id}" fieldvalue="0" title="{$lang.editable}"/>
                <!--{/if}--> </td>
            <td class="table-center">
                <!--{if $item.is_hot}-->
                <img src="templates/style/images/positive_enabled.gif" ectype="inline_edit" fieldname="is_hot" fieldid="{$item.id}" fieldvalue="1" title="{$lang.editable}"/>
                <!--{else}-->
                <img src="templates/style/images/positive_disabled.gif" ectype="inline_edit" fieldname="is_hot" fieldid="{$item.id}" fieldvalue="0" title="{$lang.editable}"/>
                <!--{/if}--> </td>
            <td class="table-center"><span ectype="inline_edit" fieldname="sort_order" fieldid="{$item.id}" datatype="pint" maxvalue="255" class="editable" title="{$lang.editable}">{$item.sort_order}</span></td>
            <td class="handler">
            <a href="index.php?app=hotgoods&amp;act=edit&amp;id={$item.id}">{$lang.edit}</a>
                |
                <a href="javascript:drop_confirm('{$lang.drop_confirm}', 'index.php?app=hotgoods&amp;act=drop&amp;id={$item.id}');">{$lang.drop}</a>
            </td>
        </tr>
        <!--{foreachelse}-->
        <tr class="no_data">
            <td colspan="6">{$lang.no_data}</td>
        </tr>
        <!--{/foreach}-->
    </table>
    <!--{if $hotgoods}-->
    <div id="dataFuncs">
        <div id="batchAction" class="left paddingT15">&nbsp;&nbsp;
            <input class="formbtn batchButton" type="button" value="{$lang.drop}" name="id" uri="index.php?app=hotgoods&act=drop" presubmit="confirm('{$lang.drop_confirm}');" />
            &nbsp;&nbsp;
           <!-- <input class="formbtn batchButton" type="button" value="lang.update_order" name="id" presubmit="updateOrder(this);" />-->
        </div>
        <div class="pageLinks">
            {include file=page.bottom.html}
        </div>
        <div class="clear"></div>
    </div>
    <!--{/if}-->
</div>
<div class="feature-wrap" id="feature_wrap"></div>
<script type="text/html" id="feature_cont">
    <h2>推荐商品</h2>
    <a href="javascript:void(0)" class="close_btn">X</a>
    <form action="" method="post">
        <table class="infoTable">
            <tr>
                <td width="70" height="40"> 商品URL：</td>
                <td>
                    <textarea style="height: 200px;" name="store_text" id="store_text"></textarea>
                </td>
            </tr>
            <tr>
                <td height="20" colspan="2">商品链接、或添入商品的id，id之间可用任意字符分割，如:1,2,3</td>
            </tr>
            <tr>
                <td align="right" height="50">&nbsp;</td>
                <td>
                    <input class="formbtn mgr10" type="submit" id="feature_submit" name="Submit" value="提交" />
                    <input class="formbtn" type="reset" name="reset" value="重置" />
                </td>
            </tr>
        </table>
    </form>
</script>
<script type="text/javascript">
    $(function(){
        var html=$('#feature_cont').html();
        jQuery.each($('.feature_btn'),function(){
            $(this).bind('click',function(){
                var cate_id=$(this).attr('cate_id');
                var store_str=$(this).attr('store_text');
                var $this=$(this);
                $('#feature_wrap').html(html);
                $('#feature_wrap').find('#store_text').val(store_str);
                jQuery('#feature_wrap').children('.close_btn').bind('click',function(){
                    admin.hidePop({'id':'#feature_wrap'});
                });
                jQuery('#feature_wrap').children('form').submit(function(){
                    var store_text = $('#store_text').val();
                    $.get('index.php?app=gcategory&act=ajax_recommend_store'+'&cate_id='+cate_id+'&store_text='+store_text,function(data){
                        admin.hidePop({'id':'#feature_wrap'});
                        var jdata=eval('('+data+')');
                        if(jdata.done){
                            //$this.hide();
                        }else{
                            admin.sConfirm({'info':jdata.msg,'cancel':true});
                        }
                    },'json');
                    return false;
                });
                admin.showPop({'id':'#feature_wrap','maxWrap':document});

            });
        });
    });
</script>
{include file="footer.html"}
